package com.hxtec.polaris.controller;

import com.hxtec.polaris.commons.aop.Log;
import com.hxtec.polaris.commons.api.vo.Result;
import com.hxtec.polaris.commons.exception.MyException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileNotFoundException;

/**
 * @Describtion 测试log
 * @Author yonyong
 * @Date 2020/1/2 16:58
 * @Version 1.0.0
 **/
@RestController("test")
public class TestController {

    @RequestMapping("1")
    @Log(value = "ceshi",comment = "测测试一下")
    public String test1(){
        return "1";
    }

    @RequestMapping("2")
    @Log(value = "ceshi",comment = "测测试自定义异常")
    public String test2(){
        throw new MyException(Result.error());
    }

    @RequestMapping("3")
    @Log(value = "ceshi",comment = "测测试自定义异常记录日志")
    public String test3(){
        String LOG_MSG = "11122231231";
        throw new MyException(Result.error(),LOG_MSG);
    }

    @RequestMapping("4")
    @Log(value = "ceshi",comment = "测测试系统级运行时NPE")
    public String test4(){
        throw new NullPointerException();
    }

    @RequestMapping("5")
    @Log(value = "ceshi",comment = "测测试系统级io级别异常")
    public String test5() throws FileNotFoundException {
        throw new FileNotFoundException();
    }
}
